<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>用户日志</title>
<jsp:include page="../inc.jsp"></jsp:include>
<script type="text/javascript">
	Ext.onReady(function(){
		createGrid();
		createLayout();
	});
	
	var gridEl = 'repTime-grid';
	var grid, form, selModel, toolbar, searchFlds;
	var win, updatefile, downloadfile;
	
	function createGrid() {
		var queryFlds = new Array();
		searchFlds = new Ext.util.MixedCollection();
		var fldTimeName = new Ext.form.TextField({
			name : 'loginName',
			id : gridEl + '-loginName',
			fieldLabel : '用户名',
			allowBlank : true,
			width : 200
		});

		searchFlds.add('loginName', fldTimeName);
		grid = Ext.create('gridView', {
			remoteSort : true,
			gridId : gridEl,
			checkboxSelectionModel : false,
			queryFlds : queryFlds,
			searchFlds : searchFlds,
			entityClassName : 'com.rover.entity.system.UserLog',
			queryUrl : '../userLogController/query.action',
			pageSize : 5
		});
		selModel = grid.getSelectionModel();
		selModel.on('rowselect', onRowSelect);
	}
	
	// 选择某行
	function onRowSelect(selModel, rowIndex, record) {

	}
	
	// 刷新列表
	function reloadRecords() {
		grid.getStore().reload();
	}
	
	// 创建layout
	function createLayout() {
		toolbar = new Ext.Toolbar({
			items : [ '->', 
	            searchFlds.get("loginName"), {
		        text: "搜索",
		        handler: function () {
		        	grid.load();
		        }
		    } ]
		});

		var viewport = new Ext.Viewport({
			layout : 'border',
			items : [ {
				layout : 'fit',
				region : 'north',
				border : false,
				items : [ toolbar ],
				height : 25
			}, {
				layout : 'border',
				region : 'center',
				border : false,
				items : [ grid ]
			} ]
		});

		viewport.doLayout();
	}

</script>
</head>
<body>
</body>
</html>